{-# OPTIONS -Wall #-}



module Demo01 where


import Wumpus.FontKit.AfmV2Datatypes
import Wumpus.FontKit.AfmV2Parser
import Wumpus.FontKit.Utils.ParserCombinators

import Control.Applicative


main :: IO ()
main = do 
    filetest "samples/a010013l.afm"
    return ()

demo01 = runParser number "-100"
demo02 = runParser newline  "\nComment ...\n"
demo03 = runParser (whiteSpace *> char 'z')  "Comment one-two-three\nz"
demo04 = runParser (manyTill anyChar newline) "one-two-three \n" 
demo05 = runParser (lexeme newline) "\n"
demo06 = runParser eof ""
demo07 = runParserEither (eof <?> "not EOF") "FAILURE"

filetest :: FilePath -> IO ()
filetest name = readFile name >>= print . runParserEither afmFile

demo08 :: IO ()
demo08 = print $ runParser globalInfo sample2

demo09 :: IO ()
demo09 = print $ runParser versionNumber sample2


demo10 = runParser record "FontBBox -28 -157 628 805"



sample :: String
sample = unlines $ 
  [ "StartFontMetrics 2.0"
  , "Comment Generated by pfaedit"
  , "Comment Creation Date: Thu Dec 26 23:03:13 2002"
  , "FontName URWGothicL-Book"
  , "FullName URW Gothic L Book"
  ]

sample2 :: String
sample2 = unlines $ 
  [ "StartFontMetrics 2.0"
  , "Comment Copyright (c) 1989 Adobe Systems Incorporated. All rights reserved."
  , "Comment Creation Date: Thu Sep 28 02:19:08 1989"
  , "Comment UniqueID 25665"
  , "Comment VMusage 26505 34873"
  , "FontName Courier"
  , "FullName Courier"
  , "FamilyName Courier"
  , "Weight Medium"
  , "ItalicAngle 0"
  , "IsFixedPitch true"
  , "FontBBox -28 -157 628 805"
  , "UnderlinePosition -100"
  , "UnderlineThickness 50"
  , "Version 002.002"
  , "Notice Copyright (c) 1989 Adobe Systems Incorporated. All rights reserved."
  , "EncodingScheme AdobeStandardEncoding"
  , "CapHeight 562"
  , "XHeight 426"
  , "Ascender 629" 
  , "Descender -157"
  , "StartCharMetrics 260"
  ]